﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BlueLotus7.SSQAnalyzeWebApplication.ViewModel;
using BlueLotus7.SSQAnalysisCore;
using System.Xml.Linq;

namespace BlueLotus7.SSQAnalyzeWebApplication.Controllers
{
    public class AnalyzeController : Controller
    {
        //
        // GET: /Analyze/

        public ActionResult Index()
        {
            //XDocument xDocument = XDocument.Parse(ssqData);
            XDocument xDocument = XDocument.Load("http://www.500wan.com//static/info/kaijiang/xml/ssq/list.xml");

            List<SSQLotteryStage> stages = SSQLotteryStage.ConvertSSQLottery(xDocument);

            stages.SortByIdentity();
            var result = Analyzer.Analyze(stages);
            return View("AnalysisResultReportView", result);
        }

        public ActionResult GetResult(DataRequest request)
        {
            AnalysisResult result = null;

            if (request != null)
            {
            }

            return View(result);
        }

        public JsonResult ClearAllAnalysisResult()
        {
            AjaxResult result = new AjaxResult();
            return Json(result);
        }
    }
}
